<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="<?php $this->options->charset(); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title><?php _e('账号绑定'); ?></title>
    <style>
        body {
            background-color: #f5f5f5;
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            margin: 0;
            padding: 0;
        }
        .container {
            max-width: 400px;
            margin: 60px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 4px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 30px;
        }
        .tabs {
            display: flex;
            margin-bottom: 20px;
            border-bottom: 1px solid #ddd;
        }
        .tab {
            flex: 1;
            text-align: center;
            padding: 10px;
            cursor: pointer;
        }
        .tab.active {
            font-weight: bold;
            color: #467B96;
            border-bottom: 2px solid #467B96;
        }
        .tab-content {
            display: none;
        }
        .tab-content.active {
            display: block;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            color: #555;
            font-weight: bold;
        }
        input[type="text"], input[type="password"], input[type="email"] {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .submit {
            display: block;
            width: 100%;
            padding: 10px;
            background-color: #467B96;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 20px;
        }
        .submit:hover {
            background-color: #3a6a82;
        }
        .user-info {
            text-align: center;
            margin-bottom: 20px;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
        }
        .avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            margin-bottom: 10px;
        }
        .nickname {
            font-size: 18px;
            font-weight: bold;
            color: #333;
        }
        .back {
            display: block;
            text-align: center;
            margin-top: 15px;
            color: #467B96;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1><?php _e('栖岛账号绑定'); ?></h1>
        
        <!-- 用户信息 -->
        <div class="user-info">
            <?php if (!empty($this->connect['head_img']) && $this->connect['head_img'] != '0'): ?>
            <img class="avatar" src="<?php echo $this->connect['head_img']; ?>" alt="Avatar">
            <?php endif; ?>
            <div class="nickname"><?php echo !empty($this->connect['nickname']) && $this->connect['nickname'] != '0' ? $this->connect['nickname'] : '栖岛用户'; ?></div>
        </div>
        
        <!-- 选项卡导航 -->
        <div class="tabs">
            <div class="tab active" data-tab="bind"><?php _e('绑定已有账号'); ?></div>
            <div class="tab" data-tab="register"><?php _e('注册新账号'); ?></div>
        </div>
        
        <!-- 绑定已有账号 -->
        <div class="tab-content active" id="bind-tab">
            <form method="post" action="<?php $this->options->index('/qidao_callback'); ?>">
                <div class="form-group">
                    <label for="username"><?php _e('用户名'); ?></label>
                    <input type="text" name="username" id="username" class="text" required />
                </div>
                <div class="form-group">
                    <label for="password"><?php _e('密码'); ?></label>
                    <input type="password" name="password" id="password" class="text" required />
                </div>
                <input type="hidden" name="do" value="bind" />
                <button type="submit" class="submit"><?php _e('绑定账号'); ?></button>
            </form>
        </div>
        
        <!-- 注册新账号 -->
        <div class="tab-content" id="register-tab">
            <form method="post" action="<?php $this->options->index('/qidao_callback'); ?>">
                <div class="form-group">
                    <label for="username-reg"><?php _e('用户名'); ?> *</label>
                    <input type="text" name="username" id="username-reg" class="text" required />
                </div>
                <div class="form-group">
                    <label for="password-reg"><?php _e('密码'); ?> *</label>
                    <input type="password" name="password" id="password-reg" class="text" required />
                </div>
                <div class="form-group">
                    <label for="mail"><?php _e('邮箱'); ?> *</label>
                    <input type="email" name="mail" id="mail" class="text" required />
                </div>
                <input type="hidden" name="do" value="reg" />
                <button type="submit" class="submit"><?php _e('注册账号'); ?></button>
            </form>
        </div>
        
        <a class="back" href="<?php $this->options->index(); ?>"><?php _e('返回网站首页'); ?></a>
    </div>
    
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 选项卡切换
            var tabs = document.querySelectorAll('.tab');
            tabs.forEach(function(tab) {
                tab.addEventListener('click', function() {
                    // 移除所有active类
                    document.querySelectorAll('.tab').forEach(function(t) {
                        t.classList.remove('active');
                    });
                    document.querySelectorAll('.tab-content').forEach(function(c) {
                        c.classList.remove('active');
                    });
                    
                    // 添加active类到当前选项卡
                    this.classList.add('active');
                    var tabId = this.getAttribute('data-tab') + '-tab';
                    document.getElementById(tabId).classList.add('active');
                });
            });
        });
    </script>
</body>
</html> 